home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1859 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  853 b 

  1. Path: ix.netcom.com!netnews
  2. From: dliska@ix.netcom.com (David Liska)
  3. Newsgroups: comp.lang.c++
  4. Subject: Precision question
  5. Date: Sat, 13 Jan 1996 14:15:44 GMT
  6. Organization: Netcom
  7. Message-ID: <4d8f00$t4a@cloner2.ix.netcom.com>
  8. NNTP-Posting-Host: ix-dc6-11.ix.netcom.com
  9. X-NETCOM-Date: Sat Jan 13  6:18:40 AM PST 1996
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. I am starting to learn C++ and am a bit confused about how it handles
  13. variable precision.  I have the following lines of code:
  14.  
  15.         check1=num1/num2;
  16.         check2=int(check1);
  17.         if (check1 == check2)
  18.  
  19. The purpose is to see if num1 is divisible by num2 with no remainder.
  20. This works fine until I get into the 65k range.  At this point, it
  21. calculates every number from there on as "divisible".  
  22.  
  23. I've tried setting check1 and check2 to long double, but it seems to
  24. make no difference.
  25.  
  26. Any ideas?
  27.  
  28. Dave
  29.  
  30.